package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.Hotel;
import com.example.entity.Params;
import com.example.entity.Reserve;
import com.example.mapper.HotelMapper;
import com.example.mapper.ReserveMapper;
import com.example.service.HotelService;
import com.example.service.ReserveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: PengFei.He
 * @Date: 2024/11/6 19:52
 * @Function:
 */

@Service
public class ReserveServiceImpl extends ServiceImpl<ReserveMapper, Reserve> implements ReserveService {

    @Autowired
    private ReserveMapper reserveMapper;


    @Override
    public List<Reserve> findBySearch(Params params) {
        return reserveMapper.findBySearch(params);
    }

    // 新增和编辑公用一个接口
    @Override
    public void add(Reserve reserve) {
        if (reserve.getId() == null){
            reserveMapper.insert(reserve);
        }
        reserveMapper.updateById(reserve);
    }
}
